package com.inspur_video.inspur_video.config;

import com.inspur_video.inspur_video.interceptor.Intercecptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created with IntelliJ IDEA.
 *
 * @author 小浩
 * @date 2018-08-10 09:32
 * @package com.inspur_video.inspur_video.config
 * @description
 */
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/video_back/upload").setViewName("upload");
        registry.addViewController("/video_back/tvupload").setViewName("tvupload");
        registry.addViewController("/login").setViewName("login");
        registry.addViewController("/").setViewName("login");
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new Intercecptor()).addPathPatterns("/video_back/**").excludePathPatterns("/","/login/**");
    }
}
